home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3711 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.1 KB  |  44 lines

  1. Newsgroups: comp.lang.c++
  2. Path: netcom.com!gibson
  3. From: gibson@netcom.com (Bob Gibson)
  4. Subject: Q: implicit converstion - error?
  5. Message-ID: <gibsonDLr0rs.AEB@netcom.com>
  6. Organization: A number of persons or groups united for some purpose
  7. X-Newsreader: TIN [version 1.2 PL1]
  8. Date: Thu, 25 Jan 1996 18:02:16 GMT
  9. Sender: gibson@netcom11.netcom.com
  10.  
  11.   A friend showed me a compile error that I was able to recreate
  12. with the following simple example:
  13.  
  14. --
  15. void test( const char * * ppc )
  16. {
  17.   cout << '"' << *ppc << '"' << endl;
  18. }
  19.  
  20. int main()
  21. {
  22.    char * msg = "Example message";
  23.    char * * p = &msg;
  24.  
  25.    test( ppc );            // <- Error
  26.    test( &msg );           // <- Error
  27.  
  28. }
  29. --
  30.   OK.  Here's the problem.  The compiler complains that a
  31. "char * *" can't / won't be converted to a "const char * *".
  32. I don't understand the proglem.  If the function signature
  33. says that it will treat the "char * *" in such a was as to
  34. not change the chars' to which the pointer point, what's
  35. the problem?
  36.  
  37. Thanks in advance
  38.  
  39. Bob
  40. -- 
  41. O.J. Verdict - The best innocence money can buy
  42.  
  43. Bob Gibson -- gibson@netcom.com
  44.